#include "mem_pool.h"

char*  MemPool::memory_allocate(int size) {
    char *ret = NULL;
    if (_mem_base == NULL) {
        ret = malloc(size);
    } else {
        if (size % _chunk_align_bytes) {
            size += _chunk_align_bytes - (size % _chunk_align_bytes);
        }
        if (size > _mem_avail) {
            return NULL;
        }
        ret = _mem_current;
        mem_current = ((char*)mem_current) + size;
        if (size < _mem_avail) {
            _mem_avail -= size;
        }
    }
    return ret;
}


void MemPool::memory_deallocate(char* ptr) {
    
}

